package com.by.common.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel(value = "分页查询参数")
public class PageQuery {

    @ApiModelProperty(value = "当前第几页,默认1页",required = false)
    int page;

    @ApiModelProperty(value = "每页显示多少条数据,默认10条",required = false)
    int pageSize;

    public int getPage() {
        if (page == 0)
            return 1;
        return page;
    }

    public void setPage(int page) {
        if (page <= 0){
            this.page = 1;
            return;
        }
        this.page = page;
    }

    public int getPageSize() {
        if (this.pageSize == 0)
            return 10;
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        if (pageSize <= 0){
            this.pageSize = 10;
            return;
        }
        this.pageSize = pageSize;
    }
}
